import request from "@/utils/request.js";

// .登录
export const getUsersCheckLogin = (data) => {
  return request.post("/users/checkLogin", data);
};

// .后台首页图表数据
export const getOrderTotaldata = () => {
  return request.get("/order/totaldata");
};

// .获取订单管理列表
export const getOrderList = (params) => {
  return request.get("/order/list", params);
};
// .查询订单管理列表
export const searchOrderList = (params) => {
  return request.get("/order/search", params);
};

// .编辑订单管理列表
export const editOrderList = (data) => {
  return request.post("/order/edit", data);
};

// .查询商品列表
export const getGoodsList = (params) => {
  return request.get("/goods/list", params);
};

// .删除商品
export const deleteGoods = (id) => {
  return request.get("/goods/del", id);
};

// .编辑商品
export const editGoods = (data) => {
  return request.post("/goods/edit", data);
};

// .添加商品
export const addGoods = (data) => {
  return request.post("/goods/add", data);
};

// .查询商品分类列表
export const getCategories = () => {
  return request.get("/goods/categories");
};

// .编辑商品分类
export const editCategory = (data) => {
  return request.post("/goods/editcate", data);
};

// .删除商品分类
export const deleteCategory = (id) => {
  return request.get("/goods/delcate", id);
};

// .查询商品分类列表
export const getCategoryList = (data) => {
  return request.get("/goods/catelist", data);
};

// .添加商品分类
export const addCategory = (data) => {
  return request.post("/goods/addcate", data);
};

//?11111111111111111111111111111111111111
// .获取店铺详情
export const getShopInfo = () => {
  return request.get("/shop/info");
};

// .店铺图片上传接口
export const uploadShopImage = (data) => {
  return request.post("/shop/upload", data);
};

// .店铺内容修改
export const editShopInfo = (data) => {
  return request.post("/shop/edit", data);
};

// .获取账号列表
export const getUserList = (data) => {
  return request.get("/users/list", data);
};

// .删除账号
export const deleteUser = (id) => {
  return request.get("/users/del", id);
};

// .批量删除账号
export const batchDeleteUser = (ids) => {
  return request.get(`/users/batchdel`, ids);
};

// .修改账号
export const editUser = (data) => {
  return request.post("/users/edit", data);
};
// .添加账号
export const addUser = (data) => {
  return request.post("/users/add", data);
};

// .检查旧密码是否正确
export const checkOldPassword = (data) => {
  return request.get("/users/checkoldpwd", data);
};

// .修改密码
export const editPassword = (data) => {
  return request.post("/users/editpwd", data);
};

// .导入文件
export const importExcel = (data) => {
  return request.post("/users/acc_upload", data);
};

// .订单报表
export const getOrderReport = (data) => {
  return request.get("/order/ordertotal", data);
};

// .商品报表
export const getGoodstotal = (data) => {
  return request.get("/goods/goodstotal", data);
};

// .上传头像
export const uploadAvatar = (data) => {
  return request.post("/users/avataredit", data);
};

// .个人中心
export const getUserCenter = () => {
  return request.get("/users/info");
};

// .修改头像
export const editAvatar = (data) => {
  return request.post("/users/avataredit", data);
};
